include ../../make.conf
########### lib ##############
CFLAGS = -O3
CFLAGS += -Wall
LIBS = -lpthread
//CFLAGS += -DNDEBUG
FNV_LIBOBJ = ../hash/fnv/hash_32.o ../hash/fnv/hash_64.o ../hash/fnv/hash_32a.o ../hash/fnv/hash_64a.o
FNV_OTHEROBJ = ../hash/fnv/fnv32.o ../hash/fnv/fnv64.o ../hash/fnv/fnv32a.o ../hash/fnv/fnv64a.o
FNV_TARGETS = ${FNV_LIBOBJ} #${FNV_OTHEROBJ}
HASH_FUN = ${FNV_TARGETS} ../hash/pseHash.o
CACHE_FUN = ${HASH_FUN} ../cache/pseCacheer.o
DNS_FUN = ${CACHE_FUN} pseDnsCacheer.o
all: build

build: $(DNS_FUN) lib_pseDnsCacheer.a test#lib_pseDnsCacheer.so
pseDnsCacheer.o:
	@echo;echo "============================== [$@] =============================="
	g++ $(CFLAGS) $(INC) $(DEFINES) -c pseDnsCacheer.cpp

lib_pseDnsCacheer.a:	
	@echo;echo "============================== [$@] =============================="
	ar rvu $@ $(DNS_FUN)

#lib_pseDnsCacheer.so: $(DNS_FUN)	
#	@echo;echo "============================== [$@] =============================="
#	g++ $(CFLAGS) $(INC) $(LIB) $(DEFINES) -fPIC -shared $(DNS_FUN) -o $@

test:
	@echo;echo "============================== [$@] =============================="
	g++ $(CFLAGS) $(INC) $(LIB) $(DEFINES) -o $@ test.cpp ../hash/fnv/libfnv.a ../hash/lib_pseHash.a ../cache/lib_pseCacheer.a lib_pseDnsCacheer.a
#	./test

install: pseDnsCacheer.h #lib_pseDnsCacheer.so
	cp pseDnsCacheer.h ../../inc
	cp lib_pseDnsCacheer.a ../../lib
#	install lib_pseDnsCacheer.so ../../lib/lib_pseDnsCacheer.so

clean:
	rm -rf *.o *.a *.so *~ test core *.dat
